#include <iostream>
#include "network.h"

Network::Network(PacketHandler *packet, QObject *parent)
	: QObject(parent), _tcpClient(packet), _udpServer(packet)
{
}

Network::~Network()
{

}

apiNetwork						*Network::getApi()
{
	return (new apiNetwork(this));
}

quint16							Network::ConnectToServer(const std::string &ip, const std::string &port)
{
	return _tcpClient.addServer(ip, port);
}

void							Network::SendToTcp(Packet *packet)
{
	_tcpClient.sendPacket(packet);
}

TcpClient &						Network::getTcpClient()
{
	return _tcpClient;
}

UdpServer &						Network::getUdpServer()
{
	return _udpServer;
}